(function() {
  define(['chaplin', 'lib/enums', 'alertify'], function(Chaplin, Enums, alertify) {
    'use strict';
    var feedback, showAlert, showError, showInfo;
    alertify.set({
      delay: 3000
    });
    feedback = {};
    _(feedback).extend(Chaplin.EventBroker);
    showAlert = function(text, type) {
      text = Enums.messages[text] || text;
      return alertify.success(text);
    };
    showError = function(text, type) {
      text = Enums.messages[text] || text;
      return alertify.error(text);
    };
    showInfo = function(text, type) {
      text = Enums.messages[text] || text;
      return alertify.log(text);
    };
    feedback.subscribeEvent('feedback:success', function(text) {
      return showAlert(text, 'success');
    });
    feedback.subscribeEvent('feedback:error', function(text) {
      return showError(text, 'error');
    });
    return feedback.subscribeEvent('feedback:info', function(text) {
      return showAInfo(text, 'info');
    });
  });

}).call(this);
